<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.datepick-zh-CN.js"></script>
<script src="<%=application.getContextPath() %>/js/jquery.tooltip.js" type="text/javascript"></script>
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery.tooltip.css" />
<link rel="stylesheet" type="text/css" href="<%=application.getContextPath() %>/css/smoothness.datepick.css" />
<link rel="stylesheet" type="text/css" href="<%=application.getContextPath() %>/css/validator.css" />
<script language="javascript">
	$().ready( function() {
		$('#tuangouStParam').datepick({buttonImageOnly: true, buttonImage: '../images/calendar.gif',dateFormat:"yy-mm-dd"}); 
		$('#tuangouEdParam').datepick({buttonImageOnly: true, buttonImage: '../images/calendar.gif',dateFormat:"yy-mm-dd"});
		$("tr.tdDesc").tooltip();
		$("#queryPrize").click(function(){
			var chkRequired = new Array("productIdParam","tuangouIdParam","tuangouStParam","tuangouEdParam","prodNameParam");
			var isValid = false;
			for (var i=0;i<chkRequired.length;i++) {
				var id = chkRequired[i];
				if ($.trim($("#"+id).val()) != "") {
					isValid = true;
					break;
				}
			}
			//if (!isValid) {
			//	alert("此功能必须输入以下任一栏位: \r\n商品编号 / 团购编号 / 活动日期/\r\n / 商品名称 ");				
			//}else{	
				$("#prizeQuery").attr("action","exportPrize.do");
				$("#prizeQuery").submit();
			//}	
		});
	});
	function customRange (){
		var startDt = $('#tuangouStParam').val(); //起始日
		var endDt = new Date(parseInt(startDt.substring(0,4),10),parseInt(startDt.substring(5,7),10)-1,parseInt(startDt.substring(8,10),10)); //結束日
		return {minDate:endDt,maxDate: new Date(${today})}; 
	}
</script>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<br />
<h1>抽奖活动汇出</h1>
<br /><br /><br />
<div class="data-form"><s:form action="exportPrize.do" method="post" id="prizeQuery">
	<b>商品编号：</b>
	<input name="productIdParam" type="text" id="productIdParam"
		value="${productIdParam}" size="20" maxlength="20">
	<b>团购编号：</b>
	<input name="tuangouIdParam" type="text" id="tuangouIdParam"
		value="${tuangouIdParam}" size="20" maxlength="20">
	<b>活动日期：</b>
	<input name="tuangouStParam" type="text" id="tuangouStParam"
		value="${tuangouStParam}" size="10" maxlength="10">
	<br/>
	<b>商品名称：</b>
	<input name="prodNameParam" id="prodNameParam" type="text" title="商品名称" size="30" value="${prodNameParam}">
	<input type="button" value="查寻" id="queryPrize" />	
</s:form>
</div>
<br/><br/><br/>
<s:if test="orderPrizeExportList.size > 0">
	<yaodian100:pageutil link="exportPrize.do" pagerObj="${pager}" />
		<table class="tb-1" width="100%">
		<thead>
			<tr>
				<th>团购</th>
				<th>商品名称</th>
				<th>活动日期</th>
				<th>活动最低订购人数</th>
				<th>售价</th>
				<th>订购数量</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${orderPrizeExportList}" var="orderPrize" varStatus="rows_index">
			<tr class="${orderPrize[8] == '01'? 'bg-rd' : ''}">
				<td>${orderPrize[0]}</td>
				<td>
				<span class="tg-name" title="${orderPrize[1]}">${orderPrize[1]}</span>
				<br/>${orderPrize[2]}
				<span class="icon-tuangou"></span>
				</td>
				<td>
				<fmt:formatDate value="${orderPrize[3]}" pattern="yyyy-MM-dd HH:mm:ss" /><br/>
				<fmt:formatDate value="${orderPrize[4]}" pattern="yyyy-MM-dd HH:mm:ss" />
				</td>
				<td>${orderPrize[5]}</td>
				<td>${orderPrize[6]}</td>
				<td>${orderPrize[7]}</td>
				<td>
					<yaodian100:checkPermission permissions="ROLE_ORD">
					<a href="<c-rt:url value="/orderprize/exportPrizeList.do?tuangouIdParam=${orderPrize[0]}"/>" >汇出名单</a>
					</yaodian100:checkPermission>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<yaodian100:pageutil link="exportPrize.do" pagerObj="${pager}" />
</s:if>
<br /><br /><br />
